import os

file = open('/Users/wangbin/Downloads/test.txt')

print('文件名:', file.name)
print('访问模式:', file.mode)
print('是否已关闭:', file.closed)
print('编码:', file.encoding)

os.rename('/Users/wangbin/Downloads/test.txt', '/Users/wangbin/Downloads/test2.txt')
os.remove('/Users/wangbin/Downloads/test2.txt')

file.close()
print('是否已关闭:', file.closed)
